package org.lim.domain.space.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.lim.domain.space.entity.Space;
import org.lim.domain.user.entity.User;
import org.lim.interfaces.dto.space.SpaceAddRequest;
import org.lim.interfaces.dto.space.SpaceQueryRequest;
import org.lim.interfaces.vo.space.SpaceVO;

import javax.servlet.http.HttpServletRequest;

/**
 * @author sk
 * @description 针对表【space(空间)】的数据库操作Service
 * @createDate 2025-05-29 10:25:12
 */
public interface SpaceDomainService extends IService<Space> {
    /**
     * 校验
     *
     * @param space
     * @param isAdd //  是否为创建
     */
    void validSpace(Space space, boolean isAdd);

    /**
     * 根据空间等级填充空间信息
     * @param space
     */
    void fillSpaceBySpaceLevel(Space space);

    /**
     * 转换为VO
     */
    SpaceVO getSpaceVO(Space space, HttpServletRequest request);
/**
     * 将分页数据转换成VO，脱敏
     */
    Page<SpaceVO> getSpaceVOPage(Page<Space> spacePage, HttpServletRequest request);

    /**
     * 获取查询包装类
     *
     * @param spaceQueryRequest
     * @return
     */
    QueryWrapper<Space> getQueryWrapper(SpaceQueryRequest spaceQueryRequest);

    /**
     * 添加空间
     * @param spaceAddRequest
     * @param loginUser
     * @return
     */
    long addSpace(SpaceAddRequest spaceAddRequest, User loginUser);

    /**
     * 校验空间权限
     * @param loginUser
     * @param space
     */
    void checkSpaceAuth(User loginUser, Space space);
}
